import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useMapInfoStore = defineStore(
  'mapInfo',
  () => {
    /**用户经纬度信息 */
    const mapInfo = ref({
      longitude: null,
      latitude: null,
    })
    /**修改用户经纬度信息 */
    const setMapInfo = (val) => {
      mapInfo.value = val
    }
    /**删除用户经纬度信息 */
    const deleteMapInfo = () => {
      mapInfo.value = undefined
    }

    return { mapInfo, setMapInfo, deleteMapInfo }
  },
  {
    // 数据持久化
    persist: true,
  },
)
